<!DOCTYPE html>
<html>
<head>
    <title>固定车辆停车管理-车主入场信息</title>
    <link rel="stylesheet" href="/static/assets/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/assets/css/checkbox.css" media="all">
</head>
<body>
<form class="layui-form layui-form-pane" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">ID</label>
        <div class="layui-input-inline">
            <input type="text" id="accessId" name="username" lay-verify="required" disabled autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label">费用</label>
        <div class="layui-input-inline">
            <input type="text" id="cost" lay-verify="required" disabled autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">入场时间</label>
        <div class="layui-input-inline">
            <input type="text" id="inDate" lay-verify="required" disabled autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">出场时间</label>
        <div class="layui-input-inline">
            <input type="text" id="outDate" lay-verify="required" disabled autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">入场图片</label>
        <div class="layui-input-inline">
            <img style="width: 180px;height: 180px" id="inImg" src=""/>
        </div>
        <label class="layui-form-label">出场图片</label>
        <div class="layui-input-inline">
            <img style="width: 180px;height: 180px" id="outImg" src=""/>
        </div>
    </div>
</form>
</body>
<script src="/static/assets/layui.js" charset="utf-8"></script>
<script src="/static/assets/jquery.min.js"></script>
<script>
    $(function () {
        if (sessionStorage.getItem("owner") != null) {
            function getUrlParam(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
                var r = window.location.search.substr(1).match(reg);  //匹配目标参数
                if (r != null) return unescape(r[2]);
                return null; //返回参数值
            }

            layui.use(['form', 'layer'], function () {
                var form = layui.form,
                    layer = layui.layer;
                var accessId = getUrlParam('accessId')
                $.ajax({
                    url: '/accessInfo/selectByAccessId',
                    type: 'post',
                    dataType: 'json',
                    headers: {'Content-Type': 'application/json;charset=utf8'},
                    data: JSON.stringify({
                        accessId: accessId
                    }),
                    success: function (res) {
                        var accessInfo = res.data.accessInfo;
                        $("#accessId").val(accessInfo.accessId)
                        $("#inDate").val(accessInfo.inDate)
                        $("#outDate").val(accessInfo.outDate)
                        $("#cost").val(accessInfo.cost)
                        $("#inImg").attr("src", accessInfo.inImg)
                        $("#outImg").attr("src", accessInfo.outImg)
                        layer.msg("拉取信息成功")
                        console.log(res)
                    },
                    error: function (res) {
                        layer.msg("拉取信息失败")
                    }
                })
            })
        } else {
            console.log("没有权限")
            location.href = "http://localhost:8080/desk/ownerLogin"
        }

    })
</script>